EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
    if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) then
        if IsMouseButtonPressed(1) then
        else
            Sleep(1)
        end

        i = 0;
        while (IsMouseButtonPressed(1) and i < 210) do
            if (IsKeyLockOn("capslock") or IsModifierPressed("lctrl")) then
                p = 1;
                if i < 5 then
                    p = 2
                elseif (i < 160) then
                    p = 3
                else
                    p = 3
                end

                move(p)
                Sleep(5)

            end
            i = i + 1
        end

    end
end

function outTime(start)
    t = GetRunningTime() - start;
    OutputLogMessage("%d\n",t);
end

function outM()
    x, y = GetMousePosition()
    OutputLogMessage("Mouse is at %d, %d\n", x, y)
end

function sleep1(arg)
    while (arg > 0) do
        arg = arg - 1;
        Sleep(1);
    end
end

function move(arg)
    while (arg > 0) do
        arg = arg - 1;
        MoveMouseRelative(0, arg);
    end
end
